/**
 * @file meridian_time.h
 * @brief Brief description of meridian_time.h
 * @author achdu0000@163.com
 * @version 1.0.0
 * @date 2024/07/07
 */

#ifndef MERIDIAN_TIME_H
#define MERIDIAN_TIME_H

#include <Arduino.h>
#include <lvgl.h>
#include "../../color_config/color_config.h"
#include "../../constants.h"

/**
 * get basic hour and minute clock obj to move it to the foreground
 */
lv_obj_t* get_basic_hour_and_minute_clock_meter_obj();

/**
 * set now time value
 * @param year                      the year to set (e.g., 2024)
 * @param month                     the month to set (1-12)
 * @param day                       the day to set (1-31)
 * @param hour                      the hour to set (0-23)
 * @param min                       the minute to set (0-59)
 * @return                          true if success
 * 
 */
bool set_now_time_val(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min);

/**
 * get the current year value
 * 
 * @return uint16_t the current year value.
 */
uint16_t get_year_val();

/**
 * get the current month value
 * 
 * @return uint8_t the current month value.
 */
uint8_t get_month_val();

/**
 * get the current day value
 * 
 * @return uint8_t the current day value.
 */
uint8_t get_day_val();

/**
 * get the current hour value
 * 
 * @return uint8_t the current hour value.
 */
uint8_t get_hour_val();

/**
 * get the current minute value
 * 
 * @return uint8_t the current minute value.
 */
uint8_t get_min_val();

/**
 * set ganzhi of hour (now)
 * @param hour_ganzhi_s             the string of ganzhi string in Chinese, like "甲子", "乙丑", ...
 * @return                          true if success
 */
bool set_now_hour_ganzhi(const char *hour_ganzhi_s);

/**
 * get ganzhi of hour (now)
 */
const char * get_now_hour_ganzhi();

/**
 * create basic hour and minute clock ui
 * @param parent                    the parent of the ui widgets in `lvgl`
 * @param width                     (lv_coord_t) width of ui
 * @param height                    (lv_coord_t) height of ui
 * @param content_w_ptr             (return) the width of content  
 * @param content_h_ptr             (return) the height of content 
 * @return                          true if success
 * @note                            the ui created will be center of the parent in default
 */
bool create_basic_hour_and_minute_clock_ui(lv_obj_t *parent, lv_coord_t width, lv_coord_t height, lv_coord_t*content_w_ptr, lv_coord_t*content_h_ptr);

/**
 * create extend 2 hour ganzhi  and open meridian label ui
 * @param parent                    the parent in lvgl widget
 * @param x_ofs                     the offset in direction x from the center of parent
 * @param y_ofs                     the offset in direction y from the center of parent
 * @return                          true if success
 */
bool create_extend_2_hour_ganzhi_and_open_meridian_label_ui(lv_obj_t *parent, lv_coord_t x_ofs, lv_coord_t y_ofs);

lv_timer_t*get_timer1();
lv_timer_t*get_timer2();


#endif // MERIDIAN_TIME_H
